home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mm / ccmd / cmkeyval.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-18  |  993 b   |  41 lines

  1. /*
  2.  Copyright (c) 1986, 1990 by The Trustees of Columbia University in
  3.  the City of New York.  Permission is granted to any individual or
  4.  institution to use, copy, or redistribute this software so long as it
  5.  is not sold for profit, provided this copyright notice is retained.
  6.  
  7. */
  8. /*
  9.  * generate the cmkeyval.h file.
  10.  *
  11.  * figure out what is the largest native type on the system,
  12.  * and typedef keyval to that type.
  13.  */
  14.  
  15. typedef struct {
  16.     int size;
  17.     char *name;
  18. } type;
  19.  
  20. typedef int (* cmprocptr)();
  21. type typetab[] = {
  22.     { sizeof(int), "int" },
  23.     { sizeof(char *), "char *" },
  24.     { sizeof(int *), "int *" },
  25.     { sizeof(cmprocptr), "cmprocptr" },
  26.     { sizeof(void *), "void *" },
  27. };
  28.  
  29. int typetablen = sizeof(typetab)/sizeof(type);
  30.  
  31. main() {
  32.     int i;
  33.     int max = 0;
  34.     for(i = 0; i < typetablen; i++)
  35.     if (typetab[max].size < typetab[i].size)
  36.         max = i;
  37.     printf("typedef int (* cmprocptr)();\n");
  38.     printf("typedef %s keyval;\n",typetab[max].name);
  39.     return(0);
  40. }
  41.